package com.chdwmp.product.controller;

import com.chdwmp.product.bean.CommonResponse;
import com.chdwmp.product.bean.app.Activation;
import com.chdwmp.product.service.SerialNumberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.swing.plaf.multi.MultiMenuBarUI;

/**
 * @Auther: LLL
 * @Date: 2021/3/13 21:10
 * @Description: app交互controller
 */
@Api(description = "测试LIENCESE模块", tags = {"测试LIENCESE模块接口控制层"})
@RequestMapping("/test/serial")
@RestController
public class SerialNumberController {

    @Autowired
    SerialNumberService serialNumberService;


    @GetMapping("/getList/{imei}")
    @ApiOperation(value = "获取测试LIENCESE", httpMethod = "GET", response = CommonResponse.class)
    public CommonResponse getList(@PathVariable  String imei) throws Exception {

        return new CommonResponse(serialNumberService.getTestSerialNumbers(imei));
    }


    @GetMapping("/recoverySerialNumber/{imei}/{number}")
    @ApiOperation(value = "回收测试LIENCESE", httpMethod = "GET", response = CommonResponse.class)
    public CommonResponse recoverySerialNumber(@PathVariable String imei,@PathVariable String number) throws Exception {
        serialNumberService.recoverySerialNumber(imei, number);
        return new CommonResponse();
    }


    @PostMapping("/activation/number")
    @ApiOperation(value = "激活码激活序列号", httpMethod = "POST", response = CommonResponse.class)
    public CommonResponse activationSerialNumber(@RequestBody Activation activation) throws Exception {

        return new CommonResponse(serialNumberService.activationSerialNumber(activation));
    }


}
